package com.vip.mvc.akka;

import akka.actor.UntypedActor;
import com.vip.mvc.dispacher.MyDispacher;
import com.vip.mvc.netty.NettyHttpRequestParam;

/**
 * Created by cloudy.xie on 17/2/16.
 */
public class ControllerActorDef extends UntypedActor {

    @Override
    public void onReceive(Object message) throws Exception {
        if (message instanceof NettyHttpRequestParam) {
            NettyHttpRequestParam requestParam = (NettyHttpRequestParam) message;
            getSender().tell(execute(requestParam), getSelf());
//            getContext().stop(this.getSelf());
        } else {
            unhandled(message);
        }
    }

    public Object execute(NettyHttpRequestParam requestParam) throws Exception {
//        return MyDispacher.getInstance().doDispatch(requestParam);
        return null;
    }

}
